#!/usr/bin/env python

# stoker_messages: i18n-capable module for string messages
#
# Author:   Mike Murphy (mamurph@cs.clemson.edu)
# Revision: 14 November 2008
#
#   Copyright 2007-2008 Clemson University
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
# This material is based upon work supported under a National Science
# Foundation Graduate Research Fellowship. Any opinions, findings,
# conclusions or recommendations expressed in this publication are those of
# the author(s) and do not necessarily reflect the views of the National
# Science Foundation.

import gettext
from stoker_defines import LOCALE_DIRECTORY, ENCODING

# Obtain translation for the current locale
t = gettext.translation('stoker', LOCALE_DIRECTORY, fallback = True)

# Encode the message into a printable format here. If the encoding fails
# for any reason, the failure will occur at program start.
def translate(msg):
   tr = t.ugettext(msg)
   return tr.encode(ENCODING)

_ = translate


MSG_WARNING = _('WARNING:')
MSG_ERROR = _('ERROR:')
MSG_EXIT_CODE = _('code:')

MSG_SIG_INT = _('Sending INT signal to subprocesses')
MSG_SIG_TERM = _('Sending TERM signal to subprocesses')
MSG_SIG_KILL = _('Sending KILL signal to subprocesses')
MSG_SIG_BE_PATIENT = _('Terminating subprocesses: please wait')

MSG_DROP_CIRCULAR_GROUP = _('circular group call %s dropped')
MSG_DUPLICATE_GROUP = _('duplicate group definition for %s')
MSG_DUPLICATE_MACHINE = _('duplicate machine definition for %s')
MSG_UNRESOLVED_HOSTNAME = _('could not resolve hostname: %s')
MSG_UNRESOLVED_MAC = _('could not resolve MAC address: %s')
MSG_LDAP_ERROR = _('LDAP connection error')
MSG_LDAP_MISSING = \
      _('Could not load LDAP libraries. Is python-ldap installed?')
MSG_MYSQL_ERROR = _('MySQL connection error')
MSG_MYSQL_MISSING = _('Could not load MySQL libraries. Is MySQLdb installed?')

MSG_MIN_ARGS = _('insufficient arguments (%d required)')
MSG_MAX_ARGS = _('too many arguments (%d allowed)')
MSG_UNKNOWN_COMMAND = _('unknown command: %s')
MSG_UNKNOWN_TARGET = _('unknown target: %s')

MSG_SUMMARY_OK = _('OK')
MSG_SUMMARY_FAIL = _('FAILED')

MSG_READ_ERROR = _('error reading file %s')
MSG_NO_RESOLVER = _('source %s is not available')

MSG_KNOWN_COMMANDS = _('Known Stoker commands:')
MSG_USAGE_ERROR = _('incomplete command. Use -h for help.')

# Do NOT internationalize the copyright notice... this must have a specific
# legal form (in English)
COPYRIGHT_NOTICE = 'Copyright (c) 2007-2008 Clemson University.'

STOKER_HELP_MESSAGE = _('''
General usage: stoker [switches] [<machine(s)> <command> [options] [args]]

Information switches:
--help            -h            Show this help message
--version         -v            Print version information
--reference=cmd   -r cmd        Show command documentation
--list-commands   -l            List recognized commands
--list-machines   -m            List available machines
--list-groups     -g            List defined machine groups
--list-sources    -S            List available machine sources

Parallel execution switches:
--parallel        -p            Execute in parallel (default: sequential)
--threads=n       -t n          Limit number of threads to n (implies -p)

Machine source switches:
--all             -a            Execute on all known machines
--sources=list    -s list       Limit machine sources to list

Output control switches:
--no-details      -q            Do not show command stdout/stderr results
--no-summary      -Q            Do not show result summary during execution
--concatenate     -c            Do not split stdout/stderr results by target

Stream redirection:
--input-from=path   -i path     Read standard input from path
--output-to=path    -o path     Write standard output (unseparated) to path
--error-to=path     -e path     Write standard error (unseparated) to path
''')

MSG_EXIT_SIGNAL = _('exiting on signal %d')

MSG_NO_STOKER_HOOK = _('ERROR: module %s has no stoker_hook function')
